function empList() {
	$.ajax({
		//http://localhost:8088/ems_191/emp/empList.do
		url : path + "/emp/empList.do",
		type : "post",
		dateType : "json",
		success : function(result) {
			if (result.status == 1) {
				alert(result.msg);
			} else if (result.status == 0) {
				for(var i=0;i<result.data.length;i++){
					var id = result.data[i].id;
					var name = result.data[i].name;
					var salary = result.data[i].salary;
					var age = result.data[i].age;
					$("#tb").append(
							"<tr class='row2'>"+
								"<td>"+id+"</td>"+
								"<td>"+name+"</td>"+
								"<td>"+salary+"</td>"+
								"<td>"+age+"</td>"+
								"<td>"+
									"<a onclick='deleteEmp(this)'>删除</a>&nbsp;"+
									"<a onclick='toUpdateEmp(this)'>修改</a>"+
								"</td>"
							);
				}
			}
		},
		error : function() {
			alert("查询失败");
		}
	});
}

function deleteEmp(obj){
	console.log(obj.parentElement.parentElement.children[0].innerHTML);
	var id = obj.parentElement.parentElement.children[0].innerHTML;
	$.ajax({
		url : path + "/emp/deleteEmp.do",
		type : "post",
		data:{"id":id},
		dateType : "json",
		success : function(result) {
			if(result.status==1){
				alert(result.msg)
			}else if(result.status==0){
				alert(result.msg);
				window.localtion.href="emplist.html"
			}
		},
		error : function() {
			alert("删除失败");
		}
	})
	
}
function toUpdateEmp(obj){
	console.log(obj.parentElement.parentElement.children[0].innerHTML);
	var id = obj.parentElement.parentElement.children[0].innerHTML;
	window.location.href="updateEmp.html?id="+id;
}